//
//  DLDiaryViewController.m
//  DlNote
//
//  Created by DongL on 2017/6/27.
//  Copyright © 2017年 DongL. All rights reserved.
//

#import "DLDiaryViewController.h"
#import "UIColor+CZAddition.h"
@interface DLDiaryViewController ()<UITableViewDataSource, UIGestureRecognizerDelegate>

@end

@implementation DLDiaryViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UISwipeGestureRecognizer *backSwipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(backToHome:)];
    
    [self.view addGestureRecognizer:backSwipe];
    backSwipe.delegate = self;
    self.view.backgroundColor = [UIColor cz_colorWithRed:240 green:220 blue:190];
    // Do any additional setup after loading the view.
    self.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    
    UITableView *DiaryList = [[UITableView alloc] init];
    [self.view addSubview:DiaryList];
    DiaryList.dataSource = self;
    
    [DiaryList mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.offset(0);
        make.top.offset(40);
        make.bottom.offset(-40);
    }];
    
    DiaryList.backgroundColor = [UIColor clearColor];
    [DiaryList registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cellid"];
}

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
    return YES;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return 20;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellid" forIndexPath:indexPath];
    
    cell.backgroundColor = [UIColor clearColor];
    
    cell.textLabel.text = [NSString stringWithFormat:@"%ld",indexPath.row];
    
    return cell;
}

- (void)backToHome:(UISwipeGestureRecognizer *)swipe {
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
